package cn.bone.ou.vote.mapper;

import cn.bone.ou.vote.bean.VoteInfo;
import cn.bone.ou.vote.dto.VoteDto;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface VoteInfoMapper extends BaseMapper<VoteInfo> {

    List<VoteDto.ListDto> list(@Param("communityId")Integer communityId,
                               @Param("start")Integer start,
                               @Param("num")Integer num,
                               @Param("title")String title,
                               @Param("state")Integer state);

    int countList(@Param("communityId")Integer communityId,
                  @Param("title")String title,
                  @Param("state")Integer state);

    /**更新发布状态(未开始->进行中)*/
    int updateStart();

    /**更新发布状态(进行中->已结束)*/
    int updateEnd();

    /**获取投票总数*/
    int countAll(@Param("communityId")Integer communityId);

}
